package com.yonder;

import java.util.HashMap;

public class UsersStorage {
	private static HashMap<String, String> users = new HashMap<String, String>();
	private static boolean loaded = false;

	private static void load() {
		if (!loaded) {
			addUser("cristian", CustomRoles.GOD.toString());
			addUser("vlad", CustomRoles.WORKER.toString() + "," + CustomRoles.ADMIN.toString());
			addUser("Lavi", CustomRoles.GOD.toString());
			loaded = true;
		}
	}

	public static void addUser(String username, String roles) {
		users.put(username, roles);
	}

	public static String getRoles(String user) {
		load();
		return users.get(user);
	}
	
	public static boolean findUser(String user)
	{
		load();
		return users.containsKey( user);
	}
}
